/**
 *  Copyright 2009-2010 Steven Ottenhoff (Dual-IT)
 * 
 *  This file is part of Clazzified.
 *
 *  Clazzified is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Clazzified is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Clazzified.  If not, see http://www.gnu.org/licenses/gpl.
 * 
 */
package nl.dualit.clazzified.store;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;


/**
 * Abstract super class of both the clazz store and the object store.
 * This class defines the common functions expected to be called for 
 * managing the stores as data sources.
 * 
 * @author Steven Ottenhoff
 *
 */
public abstract class AbstractStore {
	
	/**
	 * Synchronize the data in memory with the
	 * data in persistent storage.
	 */
	public abstract void synchronize();
	
	/**
	 * Explicitly create a physical connection to the database.
	 */
	public abstract void connect();
	
	/**
	 * Explicitly remove a physical connection to database.
	 * 
	 */
	public abstract void disconnect();
	
	/**
	 * Check is database connection is live.
	 * @return
	 */
	public abstract boolean isAlive();
	
	/**
	 * Build a new empty store
	 */
	public abstract void buildStore();
	
	/**
	 * Export the data from the store to a file on the filesystem. The data
	 * will be stored in the format defined in the param format. Format can 
	 * be one of XML, CSV or SQL.
	 * 
	 * @param location
	 * @param format
	 */
	public abstract void exportStore( String location, String format );
	
	/**
	 * Import data from a file in a specified format into the store. The format can
	 * be either XML, CSV or SQL. 
	 * 
	 * @param location the filesystem location of the file
	 * @param format the format of the file [ CSV | XML ]
	 * @param cleanFirst If set to true all existing data will be removed 
	 */
	public abstract void importStore( String location, String format, boolean cleanFirst );
	
	
	
}
